package com.lujianfei.androidroom.database;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;

import java.util.List;

@Dao
public interface UserDao {

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    long[] insertUser(UserEntity... userEntities);

    @Update(onConflict = OnConflictStrategy.REPLACE)
    void updateUser(UserEntity... userEntities);

    @Delete
    void deleteUser(UserEntity... userEntities);

    @Query("SELECT * FROM user where id = :id")
    List<UserEntity> queryUserById(int id);

    @Query("SELECT * FROM user")
    List<UserEntity> queryAll();
}
